# -*- coding: utf-8 -*-

import pygame, sys
from pygame.locals import*

# Author : Samuel Santos
# Data: 20/05/2012
# Source: http://stthiaggo.blogspot.com
# email: thiagsamuel@gmail.com
# Description:
# i) Como mover na diagonal

#init pygame
pygame.init()


#colors 
white = (255,255,255)
black = (0,0,0) 

#screen size
widthScreen, heightScreen = 400,400

screen = pygame.display.set_mode((widthScreen, heightScreen), 0,32)
pygame.display.set_caption("Rect")

#criando um objeto do tipo pygame.Rect
# pygame.Rect(left, top, width, height): return Rect
left = 0 #origem do eixo x
top = 0 #origem do eixo y
width = 20
height = 20

# use o pygame.draw para desenha o retangulo.
rect1 = pygame.Rect(left, top, width, height)

clock = pygame.time.Clock()
while True:

	for event in pygame.event.get():
		if event.type == pygame.QUIT:
			exit()
	
	screen.fill(white)
	
	pygame.draw.rect(screen, black, rect1)
	#movendo o objeto na diagonal

	rect1.x += 1
	rect1.y += 1
	
	#time
	clock.tick(20)
	
	#screen update
	pygame.display.flip()
	